﻿using Basic;

namespace Interface
{
    /// <summary>
    /// 事件参数
    /// </summary>
    public abstract class EventArgsBase
    {
    }

    /// <summary>
    /// 无参数
    /// </summary>
    public class EventArgs0 : EventArgsBase
    {
        private static Cacher<EventArgs0> s_Cacher = new Cacher<EventArgs0>(1, 1, 1, () => { return new EventArgs0(); });
        public static EventArgs0 Alloc()
        {
            return s_Cacher.Alloc();
        }
        public static void OnUseEnd(EventArgs0 args)
        {
            s_Cacher.OnUseEnd(args);
        }
    }

    /// <summary>
    /// 任意一个参数
    /// </summary>
    /// <typeparam name="T1"></typeparam>
    public class EventArgs1<T1> : EventArgsBase
    {
        private static Cacher<EventArgs1<T1>> s_Cacher = new Cacher<EventArgs1<T1>>(1, 1, 1, () => { return new EventArgs1<T1>(); });
        public static EventArgs1<T1> Alloc()
        {
            return s_Cacher.Alloc();
        }
        public static void OnUseEnd(EventArgs1<T1> args)
        {
            s_Cacher.OnUseEnd(args);
        }

        public T1 p1
        {
            get;
            private set;
        }
        public void Set(T1 p1)
        {
            this.p1 = p1;
        }
    }

    /// <summary>
    /// 任意两个参数
    /// </summary>
    /// <typeparam name="T1"></typeparam>
    /// <typeparam name="T2"></typeparam>
    public class EventArgs2<T1, T2> : EventArgsBase
    {
        private static Cacher<EventArgs2<T1, T2>> s_Cacher = new Cacher<EventArgs2<T1, T2>>(1, 1, 1, () => { return new EventArgs2<T1, T2>(); });
        public static EventArgs2<T1, T2> Alloc()
        {
            return s_Cacher.Alloc();
        }
        public static void OnUseEnd(EventArgs2<T1, T2> args)
        {
            s_Cacher.OnUseEnd(args);
        }

        public T1 p1
        {
            get;
            private set;
        }
        public T2 p2
        {
            get;
            private set;
        }
        public void Set(T1 p1, T2 p2)
        {
            this.p1 = p1;
            this.p2 = p2;
        }
    }

    /// <summary>
    /// 任意三个参数
    /// </summary>
    /// <typeparam name="T1"></typeparam>
    /// <typeparam name="T2"></typeparam>
    /// <typeparam name="T3"></typeparam>
    public class EventArgs3<T1, T2, T3> : EventArgsBase
    {
        private static Cacher<EventArgs3<T1, T2, T3>> s_Cacher = new Cacher<EventArgs3<T1, T2, T3>>(1, 1, 1, () => { return new EventArgs3<T1, T2, T3>(); });
        public static EventArgs3<T1, T2, T3> Alloc()
        {
            return s_Cacher.Alloc();
        }
        public static void OnUseEnd(EventArgs3<T1, T2, T3> args)
        {
            s_Cacher.OnUseEnd(args);
        }

        public T1 p1
        {
            get;
            private set;
        }
        public T2 p2
        {
            get;
            private set;
        }
        public T3 p3
        {
            get;
            private set;
        }
        public void Set(T1 p1, T2 p2, T3 p3)
        {
            this.p1 = p1;
            this.p2 = p2;
            this.p3 = p3;
        }
    }

    /// <summary>
    /// 任意四个参数
    /// </summary>
    /// <typeparam name="T1"></typeparam>
    /// <typeparam name="T2"></typeparam>
    /// <typeparam name="T3"></typeparam>
    public class EventArgs4<T1, T2, T3, T4> : EventArgsBase
    {
        private static Cacher<EventArgs4<T1, T2, T3, T4>> s_Cacher = new Cacher<EventArgs4<T1, T2, T3, T4>>(1, 1, 1, () => { return new EventArgs4<T1, T2, T3, T4>(); });
        public static EventArgs4<T1, T2, T3, T4> Alloc()
        {
            return s_Cacher.Alloc();
        }
        public static void OnUseEnd(EventArgs4<T1, T2, T3, T4> args)
        {
            s_Cacher.OnUseEnd(args);
        }

        public T1 p1
        {
            get;
            private set;
        }
        public T2 p2
        {
            get;
            private set;
        }
        public T3 p3
        {
            get;
            private set;
        }
        public T4 p4
        {
            get;
            private set;
        }
        public void Set(T1 p1, T2 p2, T3 p3, T4 p4)
        {
            this.p1 = p1;
            this.p2 = p2;
            this.p3 = p3;
            this.p4 = p4;
        }
    }
}
